package com.hmk.blogboot.web;


import com.hmk.blogboot.service.BlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/*归档控制层接口*/
@Controller
public class ArchiveShowController {

    @Autowired
    private BlogService blogService;
    //接口在archives页面展示，年份 blog列表 总共的blog数目
    @GetMapping("/archives")
    public String archives(Model model){
        //blog的map容器添加model key:年份字符串 value：blog列表
        model.addAttribute("archiveMap",blogService.archiveBlog());
        model.addAttribute("blogCount",blogService.countBlog());
        return "archives";
    }
}
